﻿@model DotNetUniLodz.Models.ArticleModel

@{
    ViewBag.Title = "Dodaj nową aktualność";
}

<div id="Content100">
    <h2>Aktualności</h2>
    @using (Html.BeginForm("Create", "Articles", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary()

        <fieldset id="CreateItem">
            <legend>Dodaj nową</legend>

            <div class="editor-label">
                Tytuł
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Article_title)
                @Html.ValidationMessageFor(model => model.Article_title)
            </div>

            <div class="editor-label">
                Treść
            </div>
            <div class="editor-field">
                @Html.Partial("EditorTemplates/tinymce_jquery_full", new DotNetUniLodz.Models.TextModel() { PropertyName = "Article_text", Value = Model == null ? string.Empty : Model.Article_text })
                @Html.ValidationMessageFor(model => model.Article_text)
            </div>

            <div class="editor-label">
                Obrazek
            </div>
            <div class="editor-field">
                @*@Html.TextBoxFor(m => m.Article_img, new { type = "file" })
                @Html.ValidationMessageFor(model => model.Article_img)*@
                <input type="file" name="Img" />
            </div>

            <div class="editor-label showHide">
                <a onclick="$('#SelectEvent').toggle()" style="cursor: pointer; color: #5f8f28;">Podepnij wydarzenie</a>
            </div>
            <div class="editor-field" id="SelectEvent" style="display: none;">
                @Html.DropDownList("EventId", (SelectList)ViewBag.Events, "Brak wydarzenia")
            </div>

            <div class="editor-label showHide">
                <a onclick="$('#SelectCategory').toggle()" style="cursor: pointer; color: #5f8f28;">Podepnij kategorię</a>
            </div>
            <div class="editor-field" id="SelectCategory" style="display: none;">
                @Html.DropDownList("CategoryId", (SelectList)ViewBag.Categories, "Brak kategorii")
            </div>
            <div class="editor-label">
                Wiadomość główna           
            </div>
            <div class="editor-field">
                @Html.CheckBoxFor(model => model.Article_isMainArticle, new { style="width:20px;" })
                @Html.ValidationMessageFor(model => model.Article_isMainArticle)
            </div>
            <p>
                <input type="submit" value="Dodaj" />
            </p>
        </fieldset>
    }

    <div>
        @Html.ActionLink("Powrót do listy aktualności", "Index", null, new { @class = "SuperLink" })
    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
